Required fields are not working correctly