Fix session bugs
Fix database bugs