removed error when calling asynchronous function synchronously