refactor way terra_State is retrieved. remove possibly incorrect assertion.