Fix a bug in the ls function.