Partial fix, still need to implement tempfile()