move fetch_state() into helpers
we need 5.4 now