Fix compile and formatting errors