Fix line reading issue with empty lines