small speed up

change function duplicate