take basename of file before appending it to tmpdir - probably fixes #8