bug fixes to testing code