fixed the odd number of element issue