fix next handling