fix session bug, remove var_export, minor cleanup