Fixed bugs in plotting scheme