fixing plotting functions