More bug fixes thanks to TripleChecker