fix options and r function