BUG: remove some duplicated code resulted by merge.