Fixing keyframes off-by-one error