fixed session.routine logic