Fix some issues with link creation