fixed model/api bugs