Adjusted code to work with g++-4.8 as well