Should have used ShadowApplication instead of Application.

Also added comment about remaning NPE possibility.