Fixed a bug in plan updating