fixed out of bounds error