Fixed a potential exception.
Added support of unicode file names.