Corona “Attempt to remove an object that has already been removed”

I’m working on a simple “breakout” game and I have problem reloading a map

for example: if I start with level1, break some bricks and lose, than I’m loading the same map again. next time that the ball collides with the same brick I “touched” before, will give me an error Attempt to remove an object that has already been removed

    local map = lime.loadMap("maps/" .. currentLevel .. ".tmx")     local layer = map:getTileLayer("bricks\_1")     local visual = lime.createVisual(map)     local physical = lime.buildPhysical(map)     function removeBricks(event)         if event.other.isBrick then             local brick = event.other             transition.to(brick, {time = 20, alpha = 0})                  score = score + brick.scoreValue             ScoreNum.text = score                   -- remove brick             brick:removeSelf()             brick = nil             ...  

                                

Consider adding some safety checks like this (also modified code so fade will happen before removal):

 local fadeTime  = 20  function removeBricks(event)         if event.other.isBrick then             local brick = event.other             transition.to(brick, {time = fadeTime, alpha = 0})                  score = score + brick.scoreValue             ScoreNum.text = score                   -- remove brick             timer.performWithDelay( fadeTime + 10,                 function()                 if( brick.removeSelf and                     type(brick.removeSelf) == "function") then                     brick:removeSelf()                end )             ...  

didn’t help 

Consider adding some safety checks like this (also modified code so fade will happen before removal):

 local fadeTime  = 20  function removeBricks(event)         if event.other.isBrick then             local brick = event.other             transition.to(brick, {time = fadeTime, alpha = 0})                  score = score + brick.scoreValue             ScoreNum.text = score                   -- remove brick             timer.performWithDelay( fadeTime + 10,                 function()                 if( brick.removeSelf and                     type(brick.removeSelf) == "function") then                     brick:removeSelf()                end )             ...  

didn’t help