Fixing error case to be kicked in only if state is non-zero.