JS fixes for Dialog creation