issue #2828 delete repeated code