fixed access error and out of bounds error