Fix reporting of errors in gather/take.