Fix segfault with task_specify_directory() and its python binding.