Make owner_id select a little less brittle

Don't crash if a case has no owner_id and/or user_id set
Merge pull request #457 from dimagi/owner_id_500

Make owner_id select a little less brittle