Fix bug in listing files