code changes to use session copy not pointer