Fix incorrect use of asInstanceOf; Id equality is still messed up