Improvement of getBerryFlux and getBerryPhase