fixes email validation and form logic