Fix GCC compile errors and cleanup