Bug fixes, add file support