sweep.c error checking