Small error handling fix