fix case where file was deleted and directory created in it's stead.