fixed wraparound

off by one error (again :( )