fixed util functions, added log scale option to plot2d