isdir(), fix refcount bug in print()