Fix Bug 933443, avoid calling tablesorter when there is no table and other ongoing cleanup

@AdrianGaudebert r?