improve error handling and fix handling of requests to correctly handle long json responses. v 0.0.4