Fix listening for the end.