Fixed indexing issue in newreg