fix bug in next