base64 enc/dec rewrite, fix #143