some fixes to compile under gcc