Various bug fixes for the UI