Integrity branch tests + fix

This fixes #206 which was broken on master.

@grahamc please check if this patch breaks anything for you.