fixing out of bounds