fixed instanceof to be isinstance