Handle validation for arrays

This should fix #8.