Fix several compile errors