fix warning: shadowing outer local variable - dir