Fixed bug for required fields