Fixed memory leak in sessions