fix bugs in instance api