stackoverflow bug fixed when test set is small