Fix error when form is loaded