Backport @nolta's path completion changes