Added base64 decode and fixed a minor size calculation mistake