recursive error checking