Fix race conditions around package-level variables

Signed-off-by: John Tuley <jtuley@pivotallabs.com>