fix zone-switching code