Fixed null check in equals