alternate version of error checking
fixes merge conflict in error checking