add permission, clean some resource