Fixed querys for populating panels. Fixed database connection error.