updated pump code to stop crash on bad input data