Minor fixes in tmp files creation and white spaces