Fix compile and test errors