adjust code for compile on g++.