Fixed a problem in the apiCalls.js file that arose from asynchronous calls