[r] debug
Fix db upgrade bug