Fixed some views to handle empty database tables without failing