Fix for planner's occasional infinit loop in FQS module.

Patch was submitted by Tomonari Katsumata and was reviewd by Ashutosh
Bapat.