         let results = realm.objects(RealmLgtm).filter {e in true} as [RealmLgtm]
         let urls = results.map{$0.url}
         let targetUrls:[String]
-        if urls.count > stackLimit {
-            targetUrls = [] + urls[0...(stackLimit - 1)]
+        if urls.count > StackLimit {
+            targetUrls = [] + urls[0...(StackLimit - 1)]
         } else {
             targetUrls = urls
         }

    private func popRandomLgtm() -> Lgtm? {
        let lgtm = stack.dequeue()
        if let lgtm = lgtm {
            if history.count >= 200 {
                history.dequeue()
            }
            history.enqueue(lgtm.url)

    /// fetch from lgtm.in/g to limit
    private func fetchLgtmFromServer() {
        fetchFromServer { [unowned self] in
            if self.stack.count < self.StackLimit {
                // fetch until stack.count reaches to limit
                self.fetchLgtmFromServer()
            } else {
