fixed instanceof issues