improve chpwd handling for builtin dirs command