fixed handling of complex numbers