fixed bug in linking