fix off by one slice index