fixed to handle null lines

small bug fix