Handling errors of arrays