Fix NPE caused by unfinished api calls being finished