also handle directory creation