add encodeable trait, fix bugs with query string encoding