Use remove_path from dir.c instead of own implementation