After a lot of hours I finaly made it! Basicly the "real" output is the output, and if the "imag" output is not zero then something is wrong. But it actualy means something! The real and imag are the components of a complex number whitc is the TRUE output.
Basicly I made everthing the same but with the complex numbers. Fell free to use!