patch replacement library