Added error functions on controller.