fix api crashes