Several bug fixes and little improvements in ui.