open/close register function