toUrl fixes

found these bugs while working on an example