Fixed permissions and some tests.