fix several problems with GCC 4.9