Fix forward propagate and add link functions, fix test