fix error when local state is empty