added changes to support stdout inside if_then statements