avoid using globals on hooks. see #87