fix asynchronous bug