fixed permission bugs