refine code of hb_service