Fixed updateforderivative