Added http client and fixed some bugs