Fixed some bugs in the UI rendering.