improve state of residence handling