fix bug with previous