Added a zone argument to metdata queries

Fixed where the search root path was not sized correctly

Added more memory allocation checks