change session variable names and add plan copying support