According to the documentation of `mktemp`, the TEMPLATE must contain at least 3 consecutive 'X's in last component. I have added them there.