fix sign error in hat derivative