Remove some debugging code and fix some inverted return codes.