fixed some bugs: remember to add patterns_result return value to custom tag handlers