fix wrong error handling introduced in 945aef