Improved the marshalling of arrays.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
Merge pull request #145 from ddobrev/master

Improved the marshalling of arrays