fix small bugs, add support for local files.