Fixing some bugs in Controller