creates directory properly, cleanup