Add check for writeable tmp dir