link not generating correctly