Your arrays are declared as 'var byte[16]'
Code:
topline var byte [16]
botline var byte [16]
That means a valid array index is from 0-15

This code here will fail when x=15
Code:
if X<=15  then
Y=(botline[x]-48)*8
Z=(botline[x+1]-48)*8 'READ  INTO VARIABLE AS TWINS
Z will try and access botline[x+1] = botline[16], which is invalid