Fix factory so that it works with g++.
Suppress some g++ warnings.