Correctly handle empty arrays.
Merge remote-tracking branch 'upstream/master'