Fixing a bug in list