hope this fixes writing directory bug