Fix for database query mode