                 data            = random_buffer( 42 )
 
                 new flash.FlashMemory network, start_address, data, address_size, page_size, page_buffers, error_callback
-                network.start_flash.lastCall.args[ 1 ]( null, mtu, receive_capacity, checksum )
+
+                start_flash_callback = network.start_flash.lastCall.args[ 1 ]
+                start_flash_callback( null, mtu, receive_capacity, checksum )
 
             describe 'start address equal to a page address', ->
 


            it 'should send the first data', ->
                expect( collect_data_send( network ) ).to.deep.equal( data.slice( 0, receive_capacity ) )

        describe 'writeing just a part of a page', ->



            send_data = network.send_data
            expect( send_data.getCall( send_data.callCount - 2 ).args[0].length ).to.equal new_mtu - 3

        it 'sends more data when progress indicates all data received at once', ->
            # Simulate that the bootloader sends a progress message, right after the first page
            [ data_send, cons ] = collect_buffer_send( network, 0, receive_capacity )

            checksum  = crc.buf data_send, checksum

            progress_callback = network.register_progress_callback.lastCall.args[ 0 ]
            progress_callback( checksum, cons, mtu, receive_capacity )

            expect( error_callback.called ).to.be.false
            expect( collect_data_send( network ).length ).to.be.least 2 * receive_capacity
