Fixed a database regression introduced in a50b32c6f01b18af8c04d2c1f1826ad87f91dc38