Fixed some bugs in controls