Add null check into equals methods