fix race condition

Signed-off-by: Alex Jackson <ajackson@pivotallabs.com>