Fixed bug in generateUri method