fix some bugs in plot function, do a lot of stuff regarding transformation functions