Fixed the grid bug; a variable was uninitialized!