fix plan generation