Improve registration callback handling to avoid issues with multiple calls