Fixed issues with grid alignment and bounds.