fix crash if register is empty