Fix bug of boolean equals() method, the reference comparison works incorrectly after deserialization.

Originally contributed by @chenghao-intel