properly deal with whitespace-only or blank lines