Fixing bug in listing directories with pg files