update NLLSQ demo programs to include analtic derivatives
   also fix some bugs