Optimize a little registry path validation