Changed error handling
Changed error handling