fixed ploting code errors