Fixed session issue, closes #610