fixes for calculations and plot forming