fix compilation errors and warnings