fixes for error handling