Fixed editing modals in firefox

Changed order of function definition/calling