Fixed -r to work with db 0