Fix javascript error which fails to show the popup