fix the heredoc parsing issues