Correct some logical issues in derivation