FIX: check first if we can open a session. if not, declare invalid