adding exception handling to metadata class