rewrite test for common prefix search
fix a bug for common_prefix_search