Fixed some bug

There was a bug which was causing some strange errors while processing bigger amount of requests to the API at the time.