update demo code
add pipe command, add missing resolve call for when macro