Found a bug in the planner and added a test to prove it.