fixed if statements using index offsets instead of addresses