Apply window.btoa/atoa functions correctly if defined