Fix coverity issues (and some PE tests \o/)