bug fixes to controller