fixed memory dealocation in planner