fixed the wrong math domain problem