Fixed a serious bug in Factor

The bug is related to the formula analysis.

Also improved the error message when MADlib is not available. It won't
be an error any more, and one can still use functions without the
'madlib.' prefix.