Bug fix to controller