backport changes from https://github.com/binarylogic/settingslogic/pull/36