Fix rules parsing bugs and add tests.
Merge branch 'master' of https://github.com/samal84/supersurvey