fix for remote refs not containing a hash; conforms with RCF6901

Remote refs may not contain a hash and may be relative to the current base url. In such cases, the previous code was failing. It has been fixed such that remote refs with no hash symbol still work.