db: Fix memory db value assignment and tests to validate