Update dependencies
Fix counting bugs