New functions

1. Fix bugs of getting registry twice
2. remove redundant outputs