fixed incompatibility between MacOS and Linux on use of mktemp