Divide file name and dir
Fix global function