Fix plot functions