API crash fixes