Remove redundant dp4_counter() calls
Avoid warning: 'keys on reference is experimental'
Avoid illegal division by zero