Fix check if JS has been initialized