add: check arrays before processing