fixed missing error handling