rename cwd to dir
support init with single string argument for dir