Fixed check and refactored changeConfig handler