Fix references to `null` and improve assertion test