Fixed permissions and other fixes