orderBy kernel bug fixes by yuanyuan