Handle null hasMany relations in _joinedResultsToJSON

Quick fix for issue #1