Fixed bugs in planner: Delete missing deleted pointers.
Fixed comparing if two states describe the same context.