fixed a off by1