bug fix for toArray with empty node lists