added finite difference checking