added null check in equals