fix duplicateted code