Corrected bug in getreg