fixed a bug in not setting the permissions