Fixed URL generation bug