some improvements to work well with modern compilers