fix implementation of make_directory