fixed some bugs with session handling and inheritance