minor update: additional error handling