refactored request flow and handled httpReply error
fixed #11