cleanup register_state method - git fix #50