replace nargin with exist( , var)