Fixed bugs with jquery patch selectors for rare use cases + added tests for those cases