fixed before and after hooks for dispose and initialize per issue #31