Fixed support for redirect testing and fixed cast exception when no -r arg