Minor optimization for #24 fix.
Only unbind document once