fix argument handling and add default fn return value