improve handling of temporary directory and interprocess communication