fix bug so that errmsgs are stored in opt.path