Fixed NPE warning about application context