Bug fixes for SORTest