Fix issue where it was possible to scroll past the end of the output, causing a panic