fixed another index out of range bug: soory for working on master