Fix incorrect error-catching debugmsg