resolving bug for odd length list