fix for odd length of array