better controller error handling