fix error with undefined callback