better error message on nested sorting