fix encoding
fix bugs in function scanAndWriteCon