index out of range fix movement component