Corrected error case handling: end of heredoc is not found.

Signed-off-by: Xiaomao Chen <xiaomao5@live.com>
Cleaned up the cows.

Signed-off-by: Xiaomao Chen <xiaomao5@live.com>