changed mktemp to mkstemp