Added import and fix some undefined variables