BUG: bad reference to state vs. data