fixed bugs and added session class