fixed linking and stdout file bug