Fixed counter bugs

I believe this will take care of our issues (fingers crossed). Now the counters handle null/undefined behavior more gracefully.