Wrong error handling corrected