Fix sort and cover by tests