fixup if statement logic