When a foriegn key is NULL and it's value is mapped with belongs_to, serialization breaks

Fixes issue #476