key and state fix