Fix validation of required fields (fixes #300)