correct error handling in models