fix refreshing twice issue