Fix bug with permissions