Fixed issues with output writing