made small fix to derivative matrices