Fix permission refactor