error checking enhanced