parameter reference in internal methods, fix variables, typeof undefined variables [ci skip]