Loop-corrected belief propagation for lattice spin models