fixed compile errors and warnings