FIxes session logic