Fixes and nodes.json consistency

Fix some minor Problems with obscure clients code, sorry for that. Seems like I haven't tested with the committed code enough. 
Add functionality to write nodes.json to temporary file and move it afterwards, instead of writing to
the file used by frontend directly. Last could possibly led to corrupted files delivered to the frontend.