mandatory fields not working as expected