add input validation and fix form dsg