restructure the testing code, and fix an issue that out of index in FirstBy when degree < core number