fix function replacement