added unit tests to metadata and app operations and fixed some bugs