diff --git a/program/js/app.js b/program/js/app.js
index 666726cf0..d0b3bd0ca 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1731,7 +1731,7 @@ function rcube_webmail()
{
var update, add_url = '';
- if (sort_col === null)
+ if (typeof sort_col == 'undefined')
sort_col = this.env.sort_col;
if (!sort_order)
sort_order = this.env.sort_order;
diff --git a/skins/default/templates/mail.html b/skins/default/templates/mail.html
index b2d51a7f0..ae3dac1d1 100644
--- a/skins/default/templates/mail.html
+++ b/skins/default/templates/mail.html
@@ -187,6 +187,7 @@