propagate errors correctly