fixed handling of heredocs