some fixes to remote url handling.

This fixes (#674 and #649)