Use Base64 encoding for OS parameter

I didn't even realize we already added this base64 code in server.rb. So instead of just escaping the OS parameter, we also encode the data in base64. I also added prependmigrate to avoid unstable conditions for the payload.

Thanks to @Meatballs1 for the original suggestion.