             durations.append(rampDuration)
         }
 
-        let observer: AURenderObserver = automation.withUnsafeBufferPointer { automationPtr in
+        let observer: AURenderObserver = events.withUnsafeBufferPointer { automationPtr in
             AKParameterAutomationGetRenderObserver(address,
                                                    scheduleParameterBlock,
                                                    44100,
                                                    startTime, // start time
                                                    automationPtr.baseAddress!,
-                                                   automation.count)
+                                                   events.count)
         }
 
         var timeStamp = AudioTimeStamp()


    func testPastAutomationTwo() {

        let automationPoints = [ AKAutomationEvent(targetValue: 880, startTime: 0, rampDuration: 0.1),
                                 AKAutomationEvent(targetValue: 440, startTime: 0.1, rampDuration: 0.1) ]

        let (addresses, values, _) = observerTest(automation: automationPoints, sampleTime: 44100)

        // If the automation is in the past, the value should be set to the final value.
        XCTAssertEqual(addresses, [42])


        let events = [AKAutomationEvent(targetValue: 1, startTime: 0, rampDuration: 1.0)]

        let (addresses, values, durations) = observerTest(events: events, sampleTime: 128)

        XCTAssertEqual(addresses, [42])
        XCTAssertEqual(values, [1.0])
