Fixed application context and added unit test to check it