Fix formatting and compatibility issues