fixed for arrays of even size