added subgrid tester in isValid