Contract innovation and legal evolution under imperfect enforcement