Rules: allow adding unlimited nested condition groups in the ui and fix some bugs