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.

Code is little more dirty, but it works.
I will include CoffeeScript if u will want me to.