Validate items before adding them (fixes #1)