anser.cc: more error check