Fix compile errors and warnings

Fix compile errors and warnings