Fix list.php for ajax filtering as per Issue 853.

Note I have not tested this myself.