Modified betterInstanceOf to make weak equality