fix makeplots function