fixed out of bounds problem.