Very strange bug with jQuery.appendTo

Type a local filepath of an image on your disk, choose "Normal" difficulty, then press Start, Reset, and Reset again, and the bug should trigger. Same behavior on Firefox 3.6.14 and IE8.

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Taquin</title>
</head>
<body>
    <div id="page">
        <div id="page-body">
            <div id="game-settings" class="page-section">
            <h3>Settings&nbsp;:</h3>
            <div id="game-settings-panel">
                    <div id="settings-image" class="game-setting">
                        <span class="label">
                            <label for="settings-image-file">Type in the filepath of the picture you want to play with&nbsp;:</label>
                        </span>
                        <span class="inputs">
                            <input id="settings-image-file" type="text" value="http://www.photosenvoyage.com/albums/Madagascar/Andilana/AndilanaBeach/AndilanaBeach%20%2800%29.jpg" />
                        </span>
                        <div class="clear"></div>
                    </div>
                    <div id="settings-size" class="game-setting">
                        <span class="label">
                            <label for="settings-size-select">Select the size of the board&nbsp;:</label>
                        </span>
                        <span class="inputs">
                            <select id="settings-size-select">
                                <option class="settings-size-option" value='{"width": 3, "height": 3}' selected="selected">3 X 3</option>
                                <option class="settings-size-option" value='{"width": 4, "height": 4}'>4 X 4</option>
                                <option class="settings-size-option" value='{"width": 5, "height": 5}'>5 X 5</option>
                                <option class="settings-size-option" value='{"width": 9, "height": 9}'>9 X 9</option>
                            </select>
                        </span>
                        <div class="clear"></div>
         ...

CSS

*
{
    margin:0;
    padding:0;
}

body
{
    color:#000;
    background-color:#fff;
    font-family:Arial,Helvetica,sans-serif;
    text-align:center;
}

.clear
{
    clear:both;
}

#page
{
    width:1000px;
    text-align:left;
    margin:0 auto;
}

#page-body
{
    padding:20px;
}

#page-body .page-section
{
    margin:0 15px;
}

#game-settings-panel
{
    width:800px;
}

#game-settings .label, #game-settings .inputs
{
    display:inline-block;
    width:50%;
    vertical-align:top;
    float:left;
}

#game-settings .game-setting
{
    margin:10px 0;
}

#game-settings  #settings-image-file
{
    width:280px;
}

#game-commands
{
    padding:10px 0px;
}

JavaScript

jQuery(document).ready(function() {
    jQuery('#command-start').click(function () {
        var imgPath = jQuery('#settings-image-file').val();
        var options = {
            "size": jQuery.parseJSON(jQuery('#settings-size-select option:selected').val()),
            "difficulty": jQuery('input[name=difficulty]:checked').val()
        };
        
        jQuery('#taquin').taquin(imgPath, options);
    });
    
    jQuery('#command-reset').click(function () {
        jQuery('#taquin').taquin('reset');
    });
});


/* ********************************************************* 
 * jQuery.taquin v1.0 by François Guillot.
 ***********************************************************/
(function ($) {
    // Sadly there are no constants in javascript
    var EASY = "easy";
    var NORMAL = "normal";
    
    var settings = {
        "size": {
            "width":  3,
            "height": 3
        },
        "difficulty":   NORMAL,
        "onSuccess":    function () { alert("You've won!"); }
    };
    
    var behavior;
    var easyBehavior = {
        "buildContainer": buildContainerEasy,
        "buildTiles": buildTilesEasy,
        "shuffleMethod": shuffleTilesEasy,
        "shuffleCount": 10
    };
    var normalBehavior = {
        "buildContainer": buildContainerNormal,
        "buildTiles": buildTilesNormal,
        "shuffleMethod": shuffleTilesNormal,
        "shuffleCount": 100
    };
    
    var imgPath;
    var methods = {
        "init": function (path, options) {
            if (!path || path === '') {
                alert("You must declare the image path.");
                return this;
            }
        
            if (options)
                $.extend(settings, options);
            
            if (settings.difficulty == EASY)
                behavior = easyBehavior;
            else if (settings.difficulty == NORMAL)
                behavior = normalBehavior;
            else {
                alert("The difficulty setting you chose is...