changed to httpclient, added bugfixes