return an empty array for empty dirs instead of throwing an exception