Fixed an issue that a local variable 'path' is overridden by a previous definition.