Apply changes from Santiago's fork.