Fixed compile warnings and errors with gcc.