Check if files is undefined

According to node.js documentation: http://nodejs.org/api/path.html#path_path_join_path1_path2, since node version 0.10, path.join method will throw exception:

    TypeError: Arguments to path.join must be strings

So, we need to check if files is undefined.