Fix setting required elements correctly