improved error handling in all controllers