adding additional error handling