Fixed escaping of new line.

Now escapes characters in correct order.