fixed trimming issue while checking required fields