reg

fix bugs and complete register