fixed a bug in math checks