Fix several compilation errors