Fix assertions.

From Malte Schwarzkopf and Matt Huxtable.