Fix order of adding count to preserve class