[fix] define next so it doesn't use the next of the function closure