fix a bug in the all function