Error handling fix

Error handling fix