fix registering callbacks