Fixed error in prev and next pointers.