             var lastValue: ValueType?
 
             return self.subscribe { result in
-                if let lastValue = lastValue, !isEqual(lastValue, result) {
+                if (lastValue.map { !isEqual($0, result) }) ?? true {
+                    lastValue = result
                     observer(result)
-                } else {
-                    if lastValue == nil {
-                        observer(result)
-                    }
                 }
-                
-                lastValue = result
             }
         }
     }

            var disposable: Disposable?
            disposable = self.subscribe { result in
                if counter < first {
                    observer(result)
                    counter += 1
                } else {
                    disposable?.dispose()
                    disposable = nil

        return Observable { observer in
            var prevValue: ValueType?
            return self.subscribe { result in
                let oldPrevValue = prevValue
                prevValue = result
                observer((result, oldPrevValue))
            }
        }
    }
