     # Update preference into database
     _updatePreference: (callback) =>
         DB.run 'INSERT OR REPLACE INTO PREFERENCE (SID, data) VALUES ($sid, $data)',
-            $sid: @data.id
+            $sid: @data.actid
             $data: JSON.stringify(@preference)
         , callback
 


            (callback) =>
                # update preference URI
                @preference.URI = "#{CONFIG.Client.Service}/#{@data.id}"

                # create (if not exists) assets directory
                Assets.createDirectory @data.id, callback

            (callback) =>
                # update database
                DB.run 'INSERT OR REPLACE INTO INFO (SID, data) VALUES ($sid, $data)',
                    $sid: @data.id
                    $data: JSON.stringify(@data)
                , callback

            (callback) =>
                # query preference
                DB.all 'SELECT * FROM PREFERENCE WHERE SID = $sid LIMIT 1',
                    $sid: @data.id
                , (err, data) =>
                    @preference = JSON.parse(data[0].DATA) if data? and data.length > 0
                    callback()

    _saveLast: (callback) =>
        DB.run 'INSERT OR REPLACE INTO META (key, value) VALUES ($key, $value)',
            $key: 'LAST_SCREENID'
            $value: @data.actid
        , callback

    # Connect to remote
