fix a probable out of range access in canmove