fix bug with -r handling