Bugfix: validating a complex record with arrays.

This contains the fix for validating a complex record with arrays. Also includes a test which verifies this case.