program runs but plot is incorrect