Fix code to compile with latest Rust