Improved performance of application:activate(); part of #215.