wasn't checking for an empty line correctly