fixed a bug in planning