fixed minor bug when detecting a full grid