bugfix: directories doesn't get copied correctly. directories ends up as a zero-byte file. Fixes #1