support older gcc versions
Merge pull request #3373 from berak:patch-2