Added fix for imaginary values