bug fix and plot better