little directory refactoring
new apis: release and query