update handler bug fix and write egain to update handler