fix bug with double registering