fix a next/prev bug