better error handling in Controller