Pab/devel

Batch of misc changes, mostly aimed at reducing the number of assertion failures in 'make check'.