Validation check on number of features in dictionary

This fixes #368