fixed bound-checking error which caused the bot to crash

More like added bound-checking but whatever