Fix for when using $TEMPLATE

Fix wrong handling of empty lines when using the $TEMPLATE macro.