fixed recursive checks, cleaned up error counting