Add tests for selector, fix selector bugs