checking if label is a function when replacing {state}