Made it work for both base64 and stdout outputs