fixed various compiler errors and warnings