Fixed a lot of bugs with selectors. Updated auto-tests.