Fixed fault in error handling