Fix issue where plotting happens twice.