fix compile errors for gcc