Fixing permissions bug