Fix cast option.

The cast option is used mostly on a server side with `GET` requests. `GET` request converts everything to strings, and the casting helps to repair types back. This patch fixes the previous implementation, that leaves the original object unchanged.