You can melt the butter halfway, remove from the heat and stir.  This way the butter cools fast and doesn't cook the egg when added.