fixed instanceof
removed error when calling asynchronous function synchronously