fix bug in plot