fix to error handling from previous