add database
solved several bugs & open register