added extra check in handleRequiredField