better magic and fix to high perm distros