We should try to allocate a register at first, and then increase the count.
Otherwise the count has been broken before throwing an error.
add checking code in case who calls decativate without calling activate before