fixed validation and error handling of mongoose errors