add license section and fix some variable initial issue