added checking of null in .equals