Fix #175: check that sessions exists before using