Required field is not working properly