Fix bug (derivative evaluated at point outside of domain of function)