fixed bug with empty or zero values for length and col variables