Issue with objects being cast to array in validators

Failing test and fix for #394