bugfix for session before begin may not work

manually do the check for all cases