fixed plotting script