JQuery Mobile data-rel="back" not working in dialogs

I'm trying to use jquery mobile dialogs in my express.js project to show errors. I was able to show the dialog with errors successfully, but my problem is that when I click the dialog close button the browser moves back to the home page then returns back to dialog. Here is my code:

div#home(data-role='page',data-theme="f",data-url='/')
    header(data-role='header')
        h1= title
    div(data-role='content',role='main')
      -if(typeof error !== "undefined")
         script(type='text/javascript')
          $(function() {
           $('#dialogbody').html("<p>#{error}</p>");
           $.mobile.changePage('#dialog', 'pop', true, true);
          });
      -if(typeof info !== "unddefined")
         script(type='text/javascript') 
          $.mobile.changePage('#dialog', 'pop', true, true);
      form(name='home',action='/', method='POST')   
       div(data-role='fieldcontain')
        fieldset(data-role='controlgroup')
         label.label(for='email') email
         input.input.required.email(id='email',type='text',value='',placeholder='name@email.com',name='email')
         label.label(for='password') password
         input.input.required(id='password',type='password',value='',placeholder='Enter your password',name='password')
        fieldset.ui-grid-a
          div.button.ui-block-a
             input.button(type='submit',value='Sign In',data-transition='fade',data-theme='a',style='width: 100%;')
          div.ui-block-b   
             input(type='submit',value='Sign Up',data-transition='fade',data-theme='b',onclick="home.action='/signup'; return true;")
        div
             a( data-transition='fade', data-theme='a',href=paypalURL) 
div(id='dialog',data-role='dialog',data-overlay-theme='a',data-transition='pop')
        div(data-role='content')
            div (id='dialogbody') 
            <a href="#" data-role="button" data-rel="back" data-theme="a">Close</a>

Is there something I missed or is it a bug in JQuery mobile?

Thanks

Is the output code correct ? Could you past it ?

You put the a element in html syntax instead of Jade, that may be the problem.