Added debug flag.
Fix: NPE if not connected to the db.