Bug fix in logic plan visitor