fixed some edge cases with complex selectors