Dealing with an infinite loop exception in shards