fixed issues with using .empty() or .html() jQuery methods