extend PlanRandTest
and fix bug exposed by extended test