more robust selector parsing and a few more tests