permissions and cleanup