update toURL to function