Fixed bug in diagnostic output, heredoc order issue