fixed a bug related to permissions of created directories