Reworked session store init to wait for connection, fixes #688