UBS has put some of its worst problems behind it but still needs to work hard to rebuild its badly damaged reputation, the Swiss bank's chief executive told employees in an internal memo on Tuesday.

Oswald Gruebel, who was appointed at the end of February to turn around the beleaguered bank, said a tax settlement with the United States last month and the Swiss government's sale of its stake in UBS were important steps in the bank's recovery.

However, he said the bank continued to face challenges.

Our results have indeed improved and certain progress has been recognized, but our reputation is still damaged, Gruebel said in an internal memo to staff.

UBS agreed on Aug. 20 to reveal the names of about 4,450 wealthy American clients to U.S. tax authorities to settle a damaging tax dispute that has pierced Swiss bank secrecy.

Later the same day, the Swiss government sold its stake in UBS for 5.5 billion Swiss francs ($5.21 billion), freeing the bank from any potential state interference as it tries to return to profit.

Gruebel said the tax deal had left clients with a bitter taste in their mouths and required extensive effort from all employees to regain their trust.

UBS, which was hit by the subprime crisis and posted in 2008 the biggest annual loss in Swiss corporate history, suffered another big loss in the second quarter but showed tentative signs of recovery as it made its first operating profit in eight quarters.

Returning the group to profitability will only be the beginning. The recovery our reputation will require hard work and relentless effort, he said. (Writing by Lisa Jucca; editing by Karen Foster) ($1=1.055 Swiss Franc)