patch funtions