Pull Request for Issue658: Derivative AB produces all zero output

There as an incorrect check (size against last index instead of last index +1).  Tested and appears to work.