rewrite for my usage.
fix merge bug