Fixed the out of bounds glitch