Fixed JS for next/prev buttons