Fixed globals, added proper vfs support