JS typo on check connection function