fix typechecking of comparison and equality ops and .. #548