The keyboard can “forget” which function the pedal port has been programmed for. This is not caused by the polarity switch on the bottom of the pedal. To solve the problem you can watch the video below, or follow the instructions given.
Click on the mac Finder at bottom left - then click on "Applications" and then double click to open "KOMPLETE KONTROL"
Click on the MIDI icon at the top-right of KOMPLETE KONTROL and select the PEDALS tab.
Click Pedal A and set the Mode to Switch.
Set your pedal's connectivity type to either Tip or Ring, depending on the physical characteristics of your sustain pedal connector. This is important to ensure that the full VALUE range is interpreted correctly by the KOMPLETE KONTROL software. Please consult your sustain pedal's documentation for more info.
Click Tip and set Number to MIDI CC# 64.
Set the Type to Ctrl Change.
Set the MIDI Channel to 1.
Set Mode to Gate.
Make sure the values are set from 0 (off) -127 (on)