fix issue duplicate subscribe event channel and optimize code