Fixed error with setting permissions