Fixed crash when relationship is to-one and empty