Controlling chirality with helix inversion in cholesteric liquid crystals