Don't send an emtpy ref to the client

The api will return Not Found when sending an empty ref.
Merge pull request #91 from NoUseFreak/handle_empty_ref

Don't send an emtpy ref to the client