Fix ambiguities and gcc compiler warning