fixed setting sorting in session; fixed handling of m2m add