Fix #40 and calculating derivative with vector argument