Adding permission and fix tests.