client.js code clean and fix work with files