Fixed the error handling code