Fix bug in database with uninitialized lengths