Fixed a logical error in the subgrid command