Restrict domains of functions to make them invertible