fix bug with collecting arrays