Fixed a bug caused by api change