fix for error handling