fixed error with prev