Fix buggy nextVal (again)