Commit dbd7618c9f removed the +1 from width and height, resulting in out-of-bounds access in last row if -L is used. Additionaly, the +1 only worked if -h or -w were used. Fix all that tracking the width and hegith of result cache individually.
dbd7618c9f