moved error into the controller