attempt at fixing max value plotting bug