added some session terminating stuff