Fixing logic bug where search never finishes.