fixed null session_ids

Fixed the NULL session_id inserted in DB on some cases.
Also fixed the SqlBypass session store.