Why are you replacing \n with space?