bug fix in plot generation