fix some issues to compile with gcc