fixing permission and creating directories