fix a bug in next and prev arrow