cleanup on session.c