Code to fix a race condition when registering handlers from service engine