minY logic fixed