Add test for double link, fix errors to pass tests