fix sign flip in numerical derivative protection