Fixed bug in taking real and imaginary part.