changes copied from https://github.com/TheCjw/cmder/commit/0f295234cc95427ccef82bb23c5493d3abeb7a57 and https://github.com/TheCjw/cmder/commit/18fea0ac0375b912eb0b3fd7a9dff14893d50b92