error handling updated