Fix generation and handling of file compilation errors