Fix #956 by adding the missing final sample to the range