Fixed linking issues on g++