Backport conditions everywhere

This backports #240.