Fixed error, replace new lines was placed after string conversion to lis...

...t causing error