fix resetState function