Correcting error in plotting