Fixed listing bug with bad sql query