Fixed bug if the number of arrays was odd