fixed bug in __init__ of Register class
code cleanup