Fixed id_as_key Db option. Improved session methods. Minor fixes