Fix ui compilation warnings.
Add ui.cpp fixes from the master branch.