Get all unit tests passing

Fix a caching problem where old hints were getting used.
Update selection tests to search for the index to insert instead of hardcoding the index so the tests are less fragile.