Added reference check in Model.equals functions