fix inf, nan, imaginary numbers