fix plotting script