Fix off by one error when shown was not given

This fixes the bug shown in #509