Introduced fixes for SQL reporting DB queries. Testing ongoing...