fixed function call duplicatoin bug