converted assertions to slightly faster if statements