fix prev and next bug