Fix for #1561 catching errors

@Kartones CR this, please.