some NULL checks for equals method

To avoid crashes