fixed next and prev bug