BUGFIX: speed up File Metadata searches and fix problem with locks