Change tmpdirectory to externalsotragedirectory