Fixed error, replace new lines was placed after string conversion to list causing error