Fix errors in derivation