cleaning up error handling some more