optimize array escape, added more tests