Fixed some bugs in plot utility.