fixing issues in cmd tool
fixing res.write() issue