Fixed default value on a new object with a custom value

It was always returning the default value when not persisted.

Regression test added to ensure it doesn't happen again.