fix casting of empty has-one relations