Fix cwd logic for IE