Apply UB constraints only on the relevant Select branches

This patch fixes the issue #55.