Fix some bug in resolve api function