Unreverting diff with bugfix

Summary: There was an off-by-one error. Whoops.

Test Plan: make test

Reviewers: pad

Reviewed By: pad

Differential Revision: https://phabricator.fb.com/D765053