rewritten session flash variable handling