corrected access_plan_2 and fixed bug with temporary()
fixed undefined issue in generated tree