Fix build errors with g++