added exitcode support,fixed crash on redefinitons of functions