Corrected an out of range bug