Improve assertions so that failure messages are clearly reported.