changed permission check