fix for #2884: Add error management to branches