updated update.cc; fixed segmentation fault