Fixed bug in sequence derivative