Fix compile problems and typo