fix compile errors on gcc