Moved create_dir to ensure_dir