Set default value if it is not null and fix repository test.