Did you try adding a "--" between your switches (if any) and the beginning of your arguments? The "--" signifies that the subsequent arguments are not switches. For instance:
ad_text_to_html -- $text
Check out this thread for more info:
https://openacs.org/forums/message-view?message_id=30269