Fixed nullpointer exception and wrong transformation