Fix a bug occured by legacy API