Fix issue with handler not being initialized in some cases