custom categories: script optimization. Refs #1984
Web UI: execute events only when saving profiles. Refs #1984 #2958