moved base64_decode function, so it does the conversion only when it got a data