Fixed the timeout issue with beforeEach/afterEach

Resolves #240