Fix potential crash on exit with multiple tabs opened
Fix javascript errors when try to evaluate undefined variables