fix recursion during match (thanks romix)