fix error in callback function