Fixed tests for session.sql and added ordering to results.