try to fix issues with invalid error handling