Fix bugs in application provider.