Fixed database relation problems when deleting client.