use lock for multithreaded, and debug info
check for old sessions