Fix rich compare with a guard