Fixed TypeError when invoking btoa(undefined)