Fix some problems in sessions_helper