fixed the here doc variable expansion bug