fixed typos variables and missed definitions

fixed typos variables and missed definitions