more conistent error handling