Fixed code to prepare report titles from database