safety check for lines array index