fixed various api bugs