support user defined rules; close #2