EmpiricalFormula: fix (negative counts were casted away)

plus small extension (contains() function)