fix a bug in plot