Fixed #15

Fixed issue with nested empty array when we have an empty collection. Also added tests to validate the above.