make kuhl_errorcheck() work better with cpp