fixed getURL function