corrected math domain bug