Adding some path checks before modifying registry in the registry