fix writing to non existent folders