Fix SEGV: client.database reference