fix next-prev bugs