Fixing out of bounds error on line count