fixed some compile errors and warnings