Fixed bugs in linking.