Fix bug where “foo.ba” would return “foo.bar.baz”